<template>
  <div class="amusement scroll-container">
    <div class="integral ">
      <div class="topIntegral">
        <svg-icon icon-class="integral" /> 积分乐园
      </div>
      <ul>
        <li v-for="(item,index) in integralData" :key="index">
          <el-image
            style="border-radius: 5px;width: 100%;height:200px"
            :src="item.imgSrc"
            fit="cover"
            lazy
            :preview-src-list="imgBigIntegral"
          />
          {{ showEllipsis(item.title,9) }}
          <!--:preview-src-list="item.imgSrc" -->
        </li>
      </ul>
    </div>
    <div class="integral">
      <div class="topIntegral">
        <svg-icon icon-class="beanTest" /> 趣味测试
      </div>
      <ul>
        <li v-for="(item,index) in beanData" :key="index">
          <el-image
            style="border-radius: 5px;width: 100%;height:200px"
            :src="item.imgSrc"
            fit="cover"
            lazy
            :preview-src-list="imgBigBean"
          />
          {{ showEllipsis(item.title,9) }}
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { showEllipsis } from '../../utils/validate';
export default {
  data() {
    return {
      integralData: [
        { id: 0, imgSrc: 'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg', title: '中奖率超高！伸出你的手' },
        { id: 1, imgSrc: 'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg', title: '欧冠竞猜火热进行中，快来参加' }
      ],
      beanData: [
        { id: 0, imgSrc: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg', title: '是灵魂伴侣还是塑料友情？' },
        { id: 1, imgSrc: 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg', title: '测测你是哪种杠精！' }
      ],
      imgBigIntegral: [],
      imgBigBean: []
    };
  },
  mounted() {
    this.getBigImg();
  },
  methods: {
    showEllipsis,
    getBigImg() {
      this.integralData.forEach(item => {
        this.imgBigIntegral.push(item.imgSrc);
      });
      this.beanData.forEach(item => {
        this.imgBigBean.push(item.imgSrc);
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.amusement{
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
.integral{
  font-size: 18px;
  font-weight: bold;
  overflow: hidden;
  .topIntegral{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    .svg-icon{
      width: 32px;
      height: 32px;
      margin-right: 5px;
    }
  }

  ul{
    margin-top: 10px;
    margin-left: 10px;
    display: flex;
    flex-wrap: wrap;
    li{
      width: calc(50% - 10px);
      height: 230px;
      margin: 0px 10px 10px 0px;
      font-size: 16px;
      font-weight: normal;
      color: #5e5e5e;
    }
  }
}
}

</style>
